/*
 * Copyright (c) Jack魏 2023 - 2023, All Rights Reserved.
 */

package cn.jackwei.yiyi.util;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.ShearCaptcha;
import cn.hutool.captcha.generator.MathGenerator;
import cn.hutool.core.math.Calculator;
import org.junit.jupiter.api.Test;

/**
 * Hutool工具测试
 *
 * @author Jack魏
 * @since 2023/11/10 20:38
 */
public class HutoolTest {

    @Test
    public void test1() {
        ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 45, 4, 4);
        // 自定义验证码内容为四则运算方式
        captcha.setGenerator(new MathGenerator());
        // 重新生成code
        captcha.createCode();
        final int code = (int) Calculator.conversion(captcha.getCode());
        System.out.println(code);
    }
}
